package com.sunday.common.core.utils;

import com.sunday.common.core.gson.GsonUtils;
import lombok.AllArgsConstructor;
import lombok.Data;

import java.io.Serializable;

@Data
@AllArgsConstructor
public class SerializationEntity implements Serializable, Cloneable {

    private int id;

    private Cat cat;

    /**
     * 浅复制
     */
    @Override
    public SerializationEntity clone() throws CloneNotSupportedException {
        return (SerializationEntity) super.clone();
    }

    @Override
    public String toString() {
        return GsonUtils.DEFAULT.toJson(this);
    }

    @Data
    @AllArgsConstructor
    public static class Cat implements Serializable {
        private String name;
    }

}
